# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-pyrad
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=pyrad
pkgver=2.4
pkgrel=1
pkgdesc="Python RADIUS Implementation"
url="https://pypi.python.org/project/pyrad"
arch="noarch"
license="BSD-3-Clause"
depends="py3-netaddr py3-six"
checkdepends="py3-pytest py3-pytest-cov"
makedepends="py3-gpep517 py3-wheel poetry"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/pyradius/pyrad/archive/refs/tags/$pkgver.tar.gz
	162_refactor-deprecated-unittest-aliases.patch
	do-not-include-example.patch
	fix-error-client-tests.patch
	"
builddir="$srcdir/$_pkgreal-$pkgver"
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m coverage run -m unittest discover -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
e4f4c687596bd226cf2cdb409a8d940c7b665fb7f722d09113dd9a1b05ab176ce8f920b235918ec01695f262930d13b4057b199cf6aac72afa54950c1fb59166  py3-pyrad-2.4.tar.gz
37d90b655fc41efe4e94600925021e4c0820eac4d2b23696e2d511901a75a17d9591ffc749253a47f89c8dd39693ca6674b3dbe1cdeaba55cec7590de602392f  162_refactor-deprecated-unittest-aliases.patch
8c3f06231e6c75811e384226629353835ab52c706752788f6efcff6a37279d74aefcff7bc88e1a1518ba6f88eb136219c33e65bbb1c041e53676dd70cf464725  do-not-include-example.patch
809cfb6b66f265af79b1b9422d57b5488741b8978e872bae98bcd42b259f9f3136d46c4e966a1d0d80dd8f7af542ce39dd7deadfd4f4c4fa74348648a52f7461  fix-error-client-tests.patch
"
